package cn.edu.ren.service.imp;

import cn.edu.ren.dao.IPersonDao;
import cn.edu.ren.pojo.Person;
import cn.edu.ren.service.IPersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @PackageName: cn.edu.ren.service
 * @ClassName: PersonServiceImp
 * @Description:
 * @author: RZS
 * @date: 2021/5/19  21:53
 */
@Service
public class PersonServiceImp implements IPersonService {

    @Autowired
    private IPersonDao personDao;

    @Override
    public List<Person> findAll() {
        return personDao.selectAll();
    }

    @Override
    public Person findById(Integer id) {
        return personDao.selectById(id);
    }

    @Override
    public void add(Person person) {
        personDao.insert(person);
    }

    @Override
    public void changeUsernameById(String username, Integer id) {
        personDao.updateUsernameById(username, id);
    }

    @Override
    public void removeById(Integer id) {
        personDao.deleteById(id);
    }
}
